home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Games of Daze
/
Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso
/
x2ftp
/
msdos
/
ai
/
gaf200b
/
example
/
heattank.fbk
next >
Wrap
Text File
|
1994-09-25
|
3KB
|
105 lines
!--------------------------------------------------------
! Water tank heat control simulated feedback
! Assume constant volume (i.e. water in = water out)
!--------------------------------------------------------
FEEDBACK TankTempFdbk
CYCLE_TIME 1.0
! Name (MIN, MAX)
IN Water_out (0.0, 1.0)
IN Gas_valve (0.0, 10.0)
IN TempWaterIn (32, 212)
INOUT Temperature (32.0, 212.0)
LOCAL Water_out_old (0.0, 1.0)
LOCAL Gas_valve_old (0.0, 10.0)
LOCAL EU_in (0, 100)
OUT EU_out (0, 100)
OUT EU_gain (-100, 100)
LOCAL EU_acc (-100, 100)
Initialization
Temperature = 72;
Water_out_old = Water_out;
Gas_valve_old = Gas_valve;
EU_gain = 0;
EU_acc = 0;
PRE_PROCESSING
EU_out = ( Temperature - TempWaterIn ) * DELTA_TIME
* ( Water_out + Water_out_old ) / 2 ;
EU_in = 10 * DELTA_TIME * ( Gas_valve + Gas_valve_old ) / 2 ;
Water_out_old = Water_out;
Gas_valve_old = Gas_valve;
POST_PROCESSING
EU_gain = EU_in - EU_out ;
IF ( EU_gain > -1 ) AND ( EU_gain < 1 ) THEN
EU_acc = EU_gain + EU_acc;
IF ( EU_acc > 1 ) OR ( EU_acc < -1 ) THEN
EU_gain = EU_acc;
EU_acc = 0;
ELSE
EU_gain = 0;
ENDIF;
ENDIF;
Temperature = Temperature + EU_gain / 100 ;
END;
PRESET ! 1
Temperature = 72;
END;
PRESET ! 2
Temperature = 72;
END;
PRESET ! 3
Temperature = 72;
END;
PRESET ! 4
Temperature = 72;
END;
PRESET ! 5
Temperature = 72;
END;
! Name Below Low High Above Truth
Symbol Zero OF Water_out ( 0.0, 0.0, 0.0, 0.2, 1.0)
Symbol Light OF Water_out ( 0.0, 0.2, 0.2, 0.4, 1.0)
Symbol Medium OF Water_out ( 0.2, 0.4, 0.4, 0.6, 1.0)
Symbol Heavy OF Water_out ( 0.4, 0.6, 0.6, 0.8, 1.0)
Symbol VeryHeavy OF Water_out ( 0.6, 0.8, 1.0, 1.0, 1.0)
! Name Below Low High Above Truth Center
Symbol Off OF Gas_valve ( 0.0, 0.0, 0.0, 2.0, 1.0, 0.0)
Symbol VeryLow OF Gas_valve ( 0.0, 2.0, 2.0, 4.0, 1.0)
Symbol Low OF Gas_valve ( 2.0, 4.0, 4.0, 6.0, 1.0)
Symbol High OF Gas_valve ( 4.0, 6.0, 6.0, 8.0, 1.0)
Symbol VeryHigh OF Gas_valve ( 6.0, 8.0, 10.0, 10.0, 1.0, 10.0)
! Name Below Low High Above Truth
Symbol VeryCold OF Temperature( 32, 32, 62, 92, 1.0)
Symbol Cold OF Temperature( 62, 92, 92, 122, 1.0)
Symbol Warm OF Temperature( 92, 122, 122, 152, 1.0)
Symbol Hot OF Temperature( 122, 152, 152, 182, 1.0)
Symbol VeryHot OF Temperature( 152, 182, 212, 212, 1.0)
IF Temperature IS VeryHot ! AND Water_out IS VeryHeavy
THEN EU_out + 2.5
IF Temperature IS Hot ! AND Water_out IS VeryHeavy
THEN EU_out + 2
IF Temperature IS Warm ! AND Water_out IS VeryHeavy
THEN EU_out + 1.5
IF Temperature IS Cold ! AND Water_out IS VeryHeavy
THEN EU_out + 1
END TankTempFdbk;